home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
basic
/
bwb110e.zip
/
BWBASIC.DOC
next >
Wrap
Text File
|
1992-10-27
|
17KB
|
442 lines
Bywater BASIC Interpreter/Shell, version 1.10
---------------------------------------------
Copyright (c) 1992, Ted A. Campbell
for bwBASIC version 1.10, 1 November 1992
CONTENTS:
1. DESCRIPTION
2. TERMS OF USE
3. COMMANDS AND FUNCTIONS IMPLEMENTED
4. SOME NOTES ON USAGE
5. UNIMPLEMENTED COMMANDS AND FUNCTIONS
6. SOME NOTES ON COMPILATION
7. THE STORY OF BYWATER BASIC
8. COMMUNICATIONS
1. DESCRIPTION
The Bywater BASIC Interpreter (bwBASIC) implements a large
superset of the ANSI Standard for Minimal BASIC (X3.60-1978)
in ANSI C and offers shell program facilities as an extension
of BASIC.
The set of BASIC commands and functions implemented is fairly
limited (see section three below), although more commands and
functions are implemented than appear in the specification
for Minimal BASIC. There are no commands that are terminal- or
hardware specific. (Seriously -- CLS may work under bwBASIC
on your DOS-based pc, but that is because bwBASIC shells
out to DOS when it does not recognize CLS and executes CLS there.)
The interpreter is slow. Whenever faced with a choice between
conceptual clarity and speed, I have consistently chosen
the former. The interpreter is the simplest design available,
and utilizes no system of intermediate code, which would speed
up considerably its operation. As it is, each line is interpreted
afresh as the interpreter comes to it.
bwBASIC implements one feature not available in previous BASIC
interpreters: a shell command can be entered interactively at the
bwBASIC prompt, and the interpreter will execute it under a
command shell. For instance, the command "dir *.bas" can be
entered in bwBASIC (under DOS, or "ls -l *.bas" under UNIX) and
it will be executed as from the operating system command line.
Shell commands can also be given on numbered lines in a bwBASIC
program, so that bwBASIC can be used as a shell programming
language. bwBASIC's implementation of the RMDIR, CHDIR, MKDIR,
NAME, KILL, ENVIRON, and ENVIRON$() commands and functions
offer further shell-processing capabilities.
2. TERMS OF USE:
The bwBASIC source code and executables produced from it can be
used subject to the following statement which is included in
the header to all the source code files:
All U.S. and international copyrights are claimed by the
author. The author grants permission to use this code
and software based on it under the following conditions:
(a) in general, the code and software based upon it may be
used by individuals and by non-profit organizations; (b) it
may also be utilized by governmental agencies in any country,
with the exception of military agencies; (c) the code and/or
software based upon it may not be sold for a profit without
an explicit and specific permission from the author, except
that a minimal fee may be charged for media on which it is
copied, and for copying and handling; (d) the code must be
distributed in the form in which it has been released by the
author; and (e) the code and software based upon it may not
be used for illegal activities.
3. BASIC COMMANDS AND FUNCTIONS IMPLEMENTED:
ABS( number )
ASC( string$ )
ATN( number )
CHAIN [MERGE] file-name [, line-number] [, ALL]
CHR$( number )
CINT( number )
CLEAR
CLOSE [[#]file-number]...
COMMON variable [, variable...]
COS( number )
CSNG( number )
CVD( string$ )
CVI( string$ )
CVS( string$ )
DATA constant[,constant]...
DATE$
DEF FNname(arg...)] = expression
DEFDBL letter[-letter](, letter[-letter])...
DEFINT letter[-letter](, letter[-letter])...
DEFSNG letter[-letter](, letter[-letter])...
DEFSTR letter[-letter](, letter[-letter])...
DELETE line[-line]
DIM variable(elements...)[variable(elements...)]...
END
ENVIRON variable-string = string
ENVIRON$( variable-string )
EOF( device-number )
ERASE variable[, variable]...
ERL
ERR
ERROR number
EXP( number )
FIELD [#] device-number, number AS string-variable [, number AS string-variable...]
FOR counter = start TO finish [STEP increment]
GET [#] device-number [, record-number]
GOSUB line
GOTO line
HEX$( number )
IF expression THEN statement [ELSE statement]
INPUT [# device-number]|[;]["prompt string";]list of variables
INSTR( [start-position,] string-searched$, string-pattern$ )
INT( number )
KILL file-name
LEFT$( string$, number-of-spaces )
LEN( string$ )
LET variable = expression
LINE INPUT [[#] device-number,]["prompt string";] string-variable$
LIST line[-line]
LOAD file-name
LOC( device-number )
LOF( device-number )
LOG( number )
LSET string-variable$ = expression
MERGE file-name
MID$( string$, start-position-in-string[, number-of-spaces ] )
MKD$( double-value# )
MKI$( integer-value% )
MKS$( single-value! )
NAME old-file-name AS new-file-name
NEW
NEXT counter
OCT$( number )
ON variable GOTO|GOSUB line[,line,line,...]
ON ERROR GOSUB line
OPEN O|I|R, [#]device-number, file-name [,record length]
file-name FOR INPUT|OUTPUT|APPEND AS [#]device-number [LEN = record-length]
OPTION BASE number
POS
PRINT [# device-number,][USING format-string$;] expressions...
PUT [#] device-number [, record-number]
RANDOMIZE number
READ variable[, variable]...
REM string
RESTORE line
RETURN
RIGHT$( string$, number-of-spaces )
RND( number )
RSET string-variable$ = expression
RUN [line][file-name]
SAVE file-name
SGN( number )
SIN( number )
SPACE$( number )
SPC( number )
SQR( number )
STOP
STR$( number )
STRING$( number, ascii-value|string$ )
SWAP variable, variable
SYSTEM
TAB( number )
TAN( number )
TIME$
TIMER
TROFF
TRON
VAL( string$ )
WEND
WHILE expression
WIDTH [# device-number,] number
WRITE [# device-number,] element [, element ]....
If DIRECTORY_CMDS is set to TRUE when the program is compiled,
then the following commands will be available:
CHDIR pathname
MKDIR pathname
RMDIR pathname
If DEBUG is set to TRUE when the program is compiled then
the following debugging commands (unique to bwBASIC) will
be available:
VARS (prints a list of all variables)
CMDS (prints a list of all commands)
FNCS (prints a list of all functions)
If COMMAND_SHELL is set to TRUE when the program is compiled,
then the user may enter a shell command at the bwBASIC prompt.
4. SOME NOTES ON USAGE:
An interactive environment is provided, so that a line with a
line number can be entered at the bwBASIC prompt and it will be
added to the program in memory.
Line numbers are not strictly required, but are useful if the
interactive enviroment is used for programming. For longer
program entry one might prefer to use an ASCII text editor, and
in this case lines can be entered without numbers. In this case,
however, one will not be able to alter the numberless lines
within the interactive environment.
Command names and function names are not case sensitive,
so that "Run" and "RUN" and "run" are equivalent and "abs()"
and "ABS()" and "Abs()" are equivalent. HOWEVER: variable
names ARE case sensitive in bwbASIC, so that "d$" and "D$"
are different variables. This differs from some BASIC
implementations where variable names are not case sensitive.
A filename can be specified on the command line and will be
LOADed and RUN immediately, so that the command line
bwbasic prog.bas
will load and execute "prog.bas".
All programs are stored as ASCII text files.
TRUE is defined as -1 and FALSE is defined as 0 in